* We multiply this number with GtkGridView:max-columns so
* that we can always display at least this many rows.
*/
-#define GTK_GRID_VIEW_MIN_VISIBLE_ROWS (30)
+#define GTK_GRID_VIEW_MAX_VISIBLE_ROWS (30)
#define DEFAULT_MAX_COLUMNS (7)
gtk_list_item_tracker_set_position (self->item_manager,
self->anchor,
position,
- (GTK_GRID_VIEW_MIN_VISIBLE_ROWS * yalign + 1) * self->max_columns,
- (GTK_GRID_VIEW_MIN_VISIBLE_ROWS * (1 - yalign) + 1) * self->max_columns);
+ (ceil (GTK_GRID_VIEW_MAX_VISIBLE_ROWS * yalign) + 1) * self->max_columns,
+ (ceil (GTK_GRID_VIEW_MAX_VISIBLE_ROWS * (1 - yalign)) + 1) * self->max_columns);
if (self->anchor_xalign != xalign ||
self->anchor_xstart != xstart ||
GtkGridView *self = GTK_GRID_VIEW (widget);
Cell *cell, *start;
GArray *heights;
- int row_height, col_min, col_nat;
+ int min_row_height, row_height, col_min, col_nat;
GtkOrientation opposite_orientation;
gboolean known;
int x, y;
guint i;
opposite_orientation = OPPOSITE_ORIENTATION (self->orientation);
+ min_row_height = ceil ((double) height / GTK_GRID_VIEW_MAX_VISIBLE_ROWS);
/* step 0: exit early if list is empty */
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
size = min;
else
size = nat;
+ size = MAX (size, min_row_height);
g_array_append_val (heights, size);
row_height = MAX (row_height, size);
}
gtk_box_append (GTK_BOX (box), data->icon);
data->name = gtk_label_new (NULL);
+ gtk_label_set_max_width_chars (GTK_LABEL (data->name), 25);
+ gtk_label_set_ellipsize (GTK_LABEL (data->name), PANGO_ELLIPSIZE_END);
gtk_box_append (GTK_BOX (box), data->name);
}
gtk_search_entry_set_key_capture_widget (GTK_SEARCH_ENTRY (search_entry), sw);
gtk_box_append (GTK_BOX (vbox), sw);
- listview = gtk_list_view_new_with_factory (
+ listview = gtk_grid_view_new_with_factory (
gtk_functions_list_item_factory_new (setup_widget,
NULL,
NULL, NULL));
selectionmodel = file_info_selection_new (G_LIST_MODEL (filter));
g_object_unref (filter);
- gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selectionmodel));
+ gtk_grid_view_set_model (GTK_GRID_VIEW (listview), G_LIST_MODEL (selectionmodel));
statusbar = gtk_statusbar_new ();
gtk_widget_add_tick_callback (statusbar, (GtkTickCallback) update_statusbar, NULL, NULL);